<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import { apiGetUserInfo, apiGetHotelList, apiSearchHotels } from '@/api/api.ts'
import type { Hotel, Result } from '@/types'

const router = useRouter()

const search = ref({
  destination: '',
  checkIn: '',
  checkOut: '',
  guests: 1,
})

const user = ref<any>(null)
const hotels = ref<Hotel[]>([])
const page = ref(1)
const pageSize = ref(6)
const total = ref(0)
const loading = ref(false)

// 骨架屏加载状态
const skeletonCount = 3
const skeletonArray = Array(skeletonCount).fill(0)

// 热门目的地
const popularDestinations = ref([
  { name: '北京', image: 'https://images.unsplash.com/photo-1584646098378-0874589d76b1?ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80' },
  { name: '上海', image: 'https://images.unsplash.com/photo-1538428494232-9c0d8a3ab403?ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80' },
  { name: '广州', image: 'https://so1.360tres.com/t01f4f3a99edead365c.jpg' },
  { name: '深圳', image: 'https://ts1.tc.mm.bing.net/th/id/R-C.202d5c6144037da931c449a5d64ff909?rik=HAykB98qFrflKQ&riu=http%3a%2f%2fn.sinaimg.cn%2fsinacn12%2f622%2fw1422h800%2f20181011%2f289e-hmhafiq8795975.jpg&ehk=8ThOK5rxOvJAV5vS2GzEuSC1O7ARCO9tog9l0aRcXsk%3d&risl=&pid=ImgRaw&r=0' },
])

// 当前搜索条件
const currentSearchParams = ref<any>(null);

// 酒店列表数据处理
const sortedHotels = computed(() => {
  return hotels.value;
});

function loadHotels() {
  loading.value = true
  apiGetHotelList(page.value, pageSize.value)
    .then((res: any) => {
      if (res && res.code === 200 && Array.isArray(res.data)) {
        hotels.value = res.data
        total.value = parseInt(res.msg) || 0
      } else {
        hotels.value = []
        total.value = 0
      }
    })
    .catch(() => {
      hotels.value = []
      total.value = 0
    })
    .finally(() => {
      loading.value = false
    })
}

// 搜索酒店
function searchHotels(params: any) {
  loading.value = true
  apiSearchHotels({
    ...params,
    page: page.value,
    pageSize: pageSize.value
  })
    .then((res: any) => {
      if (res && res.code === 200 && Array.isArray(res.data)) {
        hotels.value = res.data
        total.value = parseInt(res.msg) || 0
      } else {
        hotels.value = []
        total.value = 0
      }
    })
    .catch(() => {
      hotels.value = []
      total.value = 0
    })
    .finally(() => {
      loading.value = false
    })
}

// 初始化Coze智能体
function initCozeBot() {
  const script = document.createElement('script');
  script.src = 'https://lf-cdn.coze.cn/obj/unpkg/flow-platform/chat-app-sdk/1.2.0-beta.10/libs/cn/index.js';
  script.onload = () => {
    // @ts-ignore
    if (window.CozeWebSDK) {
      // @ts-ignore
      new window.CozeWebSDK.WebChatClient({
        config: {
          bot_id: '7517995936161972250',
        },
        userInfo: {
          name: user.value?.username || '用户',
          avatar: user.value?.avatar || 'https://cdn-icons-png.flaticon.com/512/149/149071.png',
          email: user.value?.email || 'example@example.com',
          phone: user.value?.phone || '1234567890',
          address: user.value?.address || '北京市海淀区',
          city: user.value?.city || '北京市',
          country: user.value?.country || '中国',
        },
        ui:{
          base:{
            icon: '/src/assets/hotel-ai-assistant.svg',
          },
          chatBox: {
            title: '酒店智能助手',
            subTitle: '随时为您提供酒店预订帮助',
            themeColor: '#1976d2',
            width: '380px',
            height: '600px',
            borderRadius: '16px',
            boxShadow: '0 12px 24px rgba(0,0,0,0.15)',
          },
          chatBtn: {
            size: '60px',
            borderRadius: '50%',
            boxShadow: '0 6px 16px rgba(25,118,210,0.25)',
            backgroundColor: '#1976d2',
            hoverBackgroundColor: '#1565c0',
          }
        },
        auth: {
          type: 'token',
          token: 'pat_gGftel2yGC0ktdys8btmudBQ5JOeBqatbxCccoVRv0XSCraM6JlmcQJvCKRVnBOD',
          onRefreshToken: function () {
            return 'pat_gGftel2yGC0ktdys8btmudBQ5JOeBqatbxCccoVRv0XSCraM6JlmcQJvCKRVnBOD'
          }
        }
      });
    }
  };
  document.head.appendChild(script);
}

onMounted(() => {
  // 清空搜索条件
  currentSearchParams.value = null;

  apiGetUserInfo()
    .then((res: any) => {
      if (res.code === 200) {
        user.value = res.data
      } else {
        user.value = null
      }
    })
    .catch(() => {
      user.value = null
    })

  loadHotels()
  
  // 初始化Coze智能体
  initCozeBot();
})

function handlePageChange(newPage: number) {
  page.value = newPage
  
  if (currentSearchParams.value) {
    // 如果有搜索条件，使用搜索条件分页
    searchHotels({
      ...currentSearchParams.value,
      page: page.value,
      pageSize: pageSize.value
    });
  } else {
    // 否则加载全部酒店
    loadHotels()
  }
  
  // 滚动到酒店列表顶部
  const hotelsSection = document.querySelector('.hotel-grid-section')
  if (hotelsSection) {
    hotelsSection.scrollIntoView({ behavior: 'smooth', block: 'start' })
  }
}

// 跳转酒店详情页
function navigateToHotel(hotelId: string|number) {
  router.push(`/hotel/${hotelId}`)
}

function handleSearch() {
  // 格式化日期
  const checkIn = search.value.checkIn ? new Date(search.value.checkIn).toISOString().split('T')[0] : '';
  const checkOut = search.value.checkOut ? new Date(search.value.checkOut).toISOString().split('T')[0] : '';
  
  // 准备搜索参数
  const searchParams = {
    destination: search.value.destination,
    checkIn: checkIn,
    checkOut: checkOut,
    guests: search.value.guests,
  };
  
  console.log('搜索条件:', searchParams);
  
  // 保存当前搜索条件
  currentSearchParams.value = searchParams;
  
  // 重置页码
  page.value = 1;
  
  // 调用搜索接口
  searchHotels(searchParams);
  
  // 滚动到酒店列表顶部
  const hotelsSection = document.querySelector('.hotel-grid-section');
  if (hotelsSection) {
    hotelsSection.scrollIntoView({ behavior: 'smooth', block: 'start' });
  }
}

// 处理目的地点击
function handleDestinationClick(destination: string) {
  search.value.destination = destination;
  handleSearch();
}
</script>

<template>
  <div class="home-page">
    <!-- 顶部导航栏 -->
    <header class="header">
      <div class="container header-inner">
        <div class="logo" @click="router.push('/')">
          <img src="../assets/logo.png" alt="酒店预订" style="width: 50px;height: 50px;margin-bottom: -12px;" />
          酒店预订
        </div>
        <nav class="nav">
          <div class="nav-left">
            <a href="#" @click.prevent="router.push('/profile?tab=orders')">我的订单</a>
          </div>
          <div class="nav-right">
            <template v-if="!user">
              <a href="#" @click.prevent="router.push('/login')">登录</a>
              <a href="#" @click.prevent="router.push('/register')">注册</a>
            </template>
            <template v-else>
              <img :src="user.avatar || 'https://cdn-icons-png.flaticon.com/512/149/149071.png'" class="avatar" @click="router.push('/profile')" />
              <span class="username">{{ user.username }}</span>
            </template>
          </div>
        </nav>
      </div>
    </header>

    <!-- Banner 区域 -->
    <div class="banner">
      <img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1600&q=80" alt="酒店Banner" />
      <div class="banner-mask"></div>
      <div class="banner-content">
        <div class="banner-title">开启您的美好旅程</div>
        <div class="banner-subtitle">探索世界各地的精品酒店，尽享难忘的住宿体验</div>
      </div>
    </div>

    <!-- 搜索表单 -->
    <div class="search-bar-wrapper">
      <el-card class="search-card">
        <el-row :gutter="24" align="middle">
          <el-col :xs="24" :sm="12" :md="6">
            <div class="form-label">目的地</div>
            <el-input 
              placeholder="请输入城市或酒店名称" 
              v-model="search.destination" 
              size="large"
              prefix-icon="el-icon-location"
            />
          </el-col>
          <el-col :xs="24" :sm="12" :md="5">
            <div class="form-label">入住日期</div>
            <el-date-picker 
              v-model="search.checkIn" 
              type="date" 
              placeholder="选择日期" 
              size="large" 
              style="width: 100%" 
            />
          </el-col>
          <el-col :xs="24" :sm="12" :md="5">
            <div class="form-label">离店日期</div>
            <el-date-picker 
              v-model="search.checkOut" 
              type="date" 
              placeholder="选择日期" 
              size="large" 
              style="width: 100%" 
            />
          </el-col>
          <el-col :xs="12" :sm="6" :md="4">
            <div class="form-label">住客</div>
            <el-input-number 
              v-model="search.guests" 
              :min="1" 
              size="large" 
              style="width: 100%" 
            />
          </el-col>
          <el-col :xs="12" :sm="6" :md="4" class="search-btn-col">
            <el-button 
              type="primary" 
              size="large" 
              style="width: 100%;font-size:1.2rem;"
              @click="handleSearch"
              :loading="loading"
            >
              搜索
            </el-button>
          </el-col>
        </el-row>
      </el-card>
    </div>

    <!-- 主要内容区域 -->
    <div class="container">
      <!-- 热门目的地 -->
      <section class="destinations-section">
        <div class="section-header elegant-header">
          <div class="section-title">热门目的地</div>
          <div class="section-subtitle">探索这些热门城市的精选酒店</div>
          <div class="section-decoration"></div>
        </div>
        
        <div class="destinations-grid">
          <div 
            v-for="(destination, index) in popularDestinations" 
            :key="index"
            class="destination-card"
            @click="handleDestinationClick(destination.name)"
          >
            <div class="destination-image">
              <img :src="destination.image" :alt="destination.name" />
            </div>
            <div class="destination-name">{{ destination.name }}</div>
          </div>
        </div>
      </section>
      
      <!-- 精选酒店列表 -->
      <section class="hotel-grid-section">
        <div class="section-header elegant-header">
          <div class="section-title">精选酒店</div>
          <div class="section-subtitle">发现特色住宿，开启完美旅程</div>
          <div class="section-decoration"></div>
        </div>
        
        <!-- 结果统计 -->
        <div class="tools-bar">
          <div class="result-count" v-if="total > 0">
            共找到 <span class="highlight">{{ total }}</span> 家酒店
          </div>
        </div>
        
        <!-- 酒店网格列表 -->
        <div class="hotel-grid" :class="{ 'is-loading': loading }">
          <!-- 骨架屏 -->
          <template v-if="loading">
            <div v-for="i in skeletonArray" :key="`skeleton-${i}`" class="hotel-card skeleton">
              <div class="hotel-card-img skeleton-img"></div>
              <div class="hotel-card-content">
                <div class="skeleton-title"></div>
                <div class="skeleton-text"></div>
                <div class="skeleton-text"></div>
                <div class="skeleton-price"></div>
              </div>
            </div>
          </template>
          
          <!-- 酒店卡片 -->
          <div 
            v-else
            v-for="hotel in sortedHotels" 
            :key="hotel.hotelId"
            class="hotel-card"
            @click="navigateToHotel(hotel.hotelId)"
          >
            <div class="hotel-card-img">
              <img :src="hotel.avatar" :alt="hotel.name" />
              <div class="hotel-card-price" v-if="hotel.price">
                <span>¥{{ hotel.price }}</span>
                <small>起/晚</small>
              </div>
            </div>
            <div class="hotel-card-content">
              <h3 class="hotel-card-name">{{ hotel.name }}</h3>
              <div class="hotel-card-location">
                <i class="el-icon-location"></i>
                <span>{{ hotel.city }}</span>
              </div>
              <div class="hotel-card-desc" v-if="hotel.description">{{ hotel.description }}</div>
              <div class="hotel-card-tags">
                <span class="hotel-tag">舒适住宿</span>
                <span class="hotel-tag">精品酒店</span>
              </div>
            </div>
          </div>
          
          <!-- 无数据提示 -->
          <div v-if="!loading && sortedHotels.length === 0" class="no-data">
            <i class="el-icon-warning-outline"></i>
            <p>暂无符合条件的酒店，请尝试其他搜索条件</p>
          </div>
        </div>
        
        <!-- 分页 -->
        <div class="pagination-container">
          <el-pagination
            background
            layout="prev, pager, next"
            :total="total"
            :page-size="pageSize"
            :current-page="page"
            @current-change="handlePageChange"
            :hide-on-single-page="true"
          />
        </div>
      </section>
    </div>

    <!-- 页脚 -->
    <footer class="footer">
      <div class="container footer-inner">
        <div class="footer-top">
          <div class="footer-logo">
            <img src="../assets/logo.png" alt="酒店预订" style="width: 40px;height: 40px;" />
            <span>酒店预订</span>
          </div>
          <div class="footer-nav">
            <a href="#">关于我们</a>
            <a href="#">帮助中心</a>
            <a href="#">联系我们</a>
            <a href="#">常见问题</a>
          </div>
        </div>
        <div class="footer-bottom">
          <div>© 2024 酒店预订. 保留所有权利。</div>
          <div class="footer-links">
            <a href="#">隐私政策</a>
            <span>·</span>
            <a href="#">使用条款</a>
          </div>
        </div>
      </div>
    </footer>
  </div>
</template>

<style scoped>
.home-page {
  background: #f8fafc;
  min-height: 100vh;
  padding-top: 72px;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #fff;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  height: 72px;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 72px;
}
.logo {
  font-size: 2.2rem;
  font-weight: bold;
  color: #1976d2;
  letter-spacing: 2px;
  cursor: pointer;
  transition: color 0.2s;
}
.logo:hover {
  color: #1565c0;
}
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-left {
  display: flex;
  align-items: center;
}
.nav-left a {
  margin-left: 0;
  margin-right: 32px;
  color: #333;
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.2s;
  font-weight: 500;
  position: relative;
}
.nav-left a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #1976d2;
  transition: width 0.3s ease;
}
.nav-left a:hover {
  color: #1976d2;
}
.nav-left a:hover::after {
  width: 100%;
}
.nav-left a:last-child {
  margin-right: 0;
}
.nav-right {
  display: flex;
  align-items: center;
}
.nav-right a {
  margin-left: 24px;
  color: #333;
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.2s;
  font-weight: 500;
}
.nav-right a:hover {
  color: #1976d2;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 8px;
  margin-left: 32px;
  object-fit: cover;
  vertical-align: middle;
  cursor: pointer;
  border: 2px solid #f0f0f0;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.avatar:hover {
  transform: scale(1.05);
  border-color: #1976d2;
}
.username {
  font-size: 1.1rem;
  font-weight: 500;
}
.banner {
  position: relative;
  width: 100%;
  height: 450px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.85);
  transition: transform 5s ease;
}
.banner:hover img {
  transform: scale(1.05);
}
.banner-mask {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  background: linear-gradient(180deg,rgba(0,0,0,0.2) 60%,rgba(0,0,0,0.5) 100%);
  z-index: 1;
}
.banner-content {
  position: absolute;
  left: 0; right: 0; top: 40%;
  transform: translateY(-50%);
  text-align: center;
  z-index: 2;
}
.banner-title {
  color: #fff;
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.2);
  margin-bottom: 16px;
}
.banner-subtitle {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 1px;
  opacity: 0.9;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
  max-width: 800px;
  margin: 0 auto;
}
.search-bar-wrapper {
  display: flex;
  justify-content: center;
  margin-top: -60px;
  margin-bottom: 60px;
  z-index: 10;
  position: relative;
}
.search-card {
  width: 100%;
  max-width: 1100px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  padding: 36px 28px 16px 28px;
  background: #fff;
  border: none;
}
.form-label {
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
  font-size: 1.05rem;
}
.search-btn-col {
  display: flex;
  align-items: flex-end;
  height: 100%;
}
.section-header {
  text-align: center;
  margin: 0 0 40px 0;
}

.elegant-header {
  position: relative;
  padding-bottom: 20px;
}

.section-title {
  font-size: 2.2rem;
  font-weight: bold;
  letter-spacing: 1px;
  color: #333;
  margin-bottom: 12px;
  position: relative;
  display: inline-block;
}

.section-subtitle {
  font-size: 1.1rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.section-decoration {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(to right, #f5222d, #ff7a45);
  border-radius: 3px;
}

/* 热门目的地样式 */
.destinations-section {
  margin-bottom: 60px;
}

.destinations-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.destination-card {
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  height: 200px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transition: all 0.4s ease;
}

.destination-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.destination-image {
  width: 100%;
  height: 100%;
}

.destination-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.destination-card:hover .destination-image img {
  transform: scale(1.1);
}

.destination-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 特惠活动样式 */
.promotion-section {
  margin-bottom: 60px;
}

.promotion-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border-left: 4px solid #f5222d;
  background: linear-gradient(to right, #fff1f0, #fff);
}

.promotion-card h3 {
  font-size: 1.3rem;
  margin: 0 0 16px 0;
  color: #f5222d;
  font-weight: 600;
  position: relative;
  padding-bottom: 10px;
}

.promotion-card h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background-color: #f5222d;
}

.promotion-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.promotion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  color: #555;
  padding: 8px 0;
  border-bottom: 1px dashed #ffccc7;
}

.promotion-item:last-child {
  border-bottom: none;
}

.promotion-item i {
  color: #f5222d;
  font-size: 1.2rem;
}

.promotion-btn {
  width: 100%;
  background: #f5222d;
  border-color: #f5222d;
  font-weight: 500;
}

.promotion-btn:hover {
  background: #ff4d4f;
  border-color: #ff4d4f;
}

/* 酒店网格样式 */
.hotel-grid-section {
  margin-bottom: 60px;
}

.tools-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 0 0 16px 0;
  border-bottom: 1px solid #eee;
}

.sort-options {
  display: flex;
  align-items: center;
}

.sort-label {
  margin-right: 12px;
  color: #666;
}

.result-count {
  color: #666;
}

.highlight {
  color: #1976d2;
  font-weight: bold;
  font-size: 1.1rem;
}

.hotel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  position: relative;
  min-height: 300px;
}

.hotel-grid.is-loading {
  opacity: 0.7;
}

.hotel-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
  transition: all 0.4s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0,0,0,0.05);
  height: 100%;
}

.hotel-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(25,118,210,0.12);
  border-color: rgba(25,118,210,0.1);
}

.hotel-card-img {
  height: 200px;
  overflow: hidden;
  position: relative;
}

.hotel-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.hotel-card:hover .hotel-card-img img {
  transform: scale(1.08);
}

.hotel-card-price {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(245, 34, 45, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hotel-card-price span {
  font-size: 1.2rem;
}

.hotel-card-price small {
  font-size: 0.8rem;
  opacity: 0.9;
}

.hotel-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.hotel-card-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #333;
}

.hotel-card-location {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.hotel-card-desc {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hotel-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

/* 骨架屏样式 */
.skeleton {
  pointer-events: none;
}

.skeleton-img {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-title {
  height: 24px;
  width: 80%;
  background: #f0f0f0;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-text {
  height: 16px;
  width: 100%;
  background: #f0f0f0;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-price {
  height: 24px;
  width: 40%;
  background: #f0f0f0;
  margin-top: auto;
  border-radius: 4px;
  align-self: flex-end;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* 无数据提示 */
.no-data {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: #999;
  text-align: center;
}

.no-data i {
  font-size: 3rem;
  margin-bottom: 16px;
  color: #ccc;
}

/* 主题卡片样式 */
.themes-section {
  margin-bottom: 60px;
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.theme-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
  transition: all 0.3s ease;
  cursor: pointer;
}

.theme-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(25,118,210,0.12);
}

.theme-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e6f7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.theme-icon i {
  font-size: 28px;
  color: #1976d2;
}

.theme-card h4 {
  font-size: 1.2rem;
  margin: 0 0 12px 0;
  color: #333;
}

.theme-card p {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
  margin: 0;
}

.hotel-tag {
  background: #f6f9fe;
  color: #1976d2;
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 0.85rem;
  border: 1px solid rgba(25,118,210,0.1);
  transition: all 0.3s ease;
}

.hotel-card:hover .hotel-tag {
  background: #e6f0ff;
  border-color: rgba(25,118,210,0.2);
}

.pagination-container {
  display: flex;
  justify-content: center;
  margin: 30px 0 0 0;
}

.footer {
  background: #fff;
  padding: 40px 0 20px 0;
  color: #666;
  font-size: 1rem;
  border-top: 1px solid #eee;
  margin-top: 20px;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 24px;
  border-bottom: 1px solid #eee;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-logo span {
  font-size: 1.4rem;
  font-weight: bold;
  color: #1976d2;
}
.footer-nav {
  display: flex;
  gap: 24px;
}
.footer-nav a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-nav a:hover {
  color: #1976d2;
}
.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: center;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
}
.footer a {
  color: #1976d2;
  text-decoration: none;
}

/* 响应式布局 */
@media (max-width: 1200px) {
  .banner {
    height: 400px;
  }
  .banner-title {
    font-size: 2.8rem;
  }
}

@media (max-width: 992px) {
  .hotel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .destinations-grid,
  .themes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .banner {
    height: 350px;
  }
  
  .banner-title {
    font-size: 2.4rem;
  }
  
  .banner-subtitle {
    font-size: 1.2rem;
  }
  
  .search-card {
    padding: 24px 16px 8px 16px;
  }
  
  .footer-top {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }
  
  .footer-nav {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .hotel-grid {
    grid-template-columns: 1fr;
  }
  
  .hotel-card-img {
    height: 180px;
  }
  
  .banner {
    height: 300px;
  }
  
  .banner-title {
    font-size: 2rem;
  }
  
  .banner-subtitle {
    font-size: 1rem;
    padding: 0 20px;
  }
  
  .search-card {
    border-radius: 12px;
    margin: 0 16px;
  }
  
  .tools-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .sort-options {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }
}

@media (max-width: 576px) {
  .header-inner {
    padding: 0 16px;
  }
  
  .nav-left a {
    margin-right: 16px;
    font-size: 1rem;
  }
  
  .nav-right a {
    margin-left: 16px;
    font-size: 1rem;
  }
  
  .banner {
    height: 250px;
  }
  
  .banner-title {
    font-size: 1.6rem;
  }
  
  .banner-subtitle {
    font-size: 0.9rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .section-subtitle {
    font-size: 0.9rem;
  }
  
  .destinations-grid,
  .themes-grid {
    grid-template-columns: 1fr;
  }
  
  .destination-card {
    height: 160px;
  }
}
</style>
